<template>
	<view class="body">
		<image src="../../static/img/pic-1.png" class="img"></image>
		<view class="loginbox">
			
			<view class="login">
				<view class="password"><input type="password" value="" placeholder="请输入密码" v-model="pass"/></view>
				<view class="line">
					
				</view>
				<view class="pass">
					<input type="password" value="" placeholder="再次输入密码" v-model="passto"/>

				</view>
			</view>
			
		</view>
		<!-- 协议 -->
		<view class="protocol">
			<label class="radio"><radio value="r1" checked="true" />
			我已阅读并同意<text>《用户使用协议》</text>和<text>《隐私政策》</text>
			</label>
		</view>
		<button class="loginbtn" @click="gologin">
			确定提交
		</button>
		
	</view>
</template>

<script>
	import {reg} from '../../api/user.js'
	export default{
		data(){
			return{
				pass:'',
				passto:'',
				mobile:''
			}
		},
		onLoad(e){
			console.log(e)
			this.mobile = e
			console.log(this.mobile)
		},
		methods:{
			
			async gologin(){if(this.pass==''){
				uni.showToast({
					title:'请设置密码'
				})
			}else if(this.passto==''){
				uni.showToast({
					title:'请再次输入密码'
				})
				
			}else if(this.pass!=this.passto){
				uni.showToast({
					title:'两次密码不一致'
				})
			}else{
				let res = await reg({mobile:this.mobile.model,pass:this.pass})
				uni.navigateTo({
					url:'/pages/login/login'
				})
			}
				
			}
		}
	}
</script>
<style lang="less">
@import '@/static/style/regpass.less';
</style>
